home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frm4_3_4
- Caption = "Bank Deposit"
- ClientHeight = 3210
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 3405
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 3210
- ScaleWidth = 3405
- Begin VB.TextBox txtNumYrs
- Height = 285
- Left = 2280
- TabIndex = 7
- Top = 1560
- Width = 975
- End
- Begin VB.PictureBox picBalance
- Height = 255
- Left = 1680
- ScaleHeight = 195
- ScaleWidth = 1515
- TabIndex = 10
- Top = 2760
- Width = 1575
- End
- Begin VB.CommandButton cmdCompute
- Caption = "Compute Balance"
- Height = 495
- Left = 120
- TabIndex = 8
- Top = 2040
- Width = 3135
- End
- Begin VB.TextBox txtNumComp
- Height = 285
- Left = 2280
- TabIndex = 5
- Top = 1080
- Width = 975
- End
- Begin VB.TextBox txtRate
- Height = 285
- Left = 2280
- TabIndex = 3
- Top = 600
- Width = 975
- End
- Begin VB.TextBox txtAmount
- Height = 285
- Left = 2280
- TabIndex = 1
- Top = 120
- Width = 975
- End
- Begin VB.Label lblBalance
- Caption = "Balance"
- Height = 255
- Left = 840
- TabIndex = 9
- Top = 2760
- Width = 735
- End
- Begin VB.Label lblNumYrs
- Caption = "Number of years"
- Height = 255
- Left = 720
- TabIndex = 6
- Top = 1560
- Width = 1455
- End
- Begin VB.Label lblNumComp
- Caption = "Number of times interest is compounded per year"
- Height = 495
- Left = 120
- TabIndex = 4
- Top = 1020
- Width = 2175
- End
- Begin VB.Label lblRate
- Caption = "Annual rate of interest"
- Height = 255
- Left = 240
- TabIndex = 2
- Top = 600
- Width = 1935
- End
- Begin VB.Label lblAmount
- Caption = "Amount of bank deposit"
- Height = 255
- Left = 120
- TabIndex = 0
- Top = 120
- Width = 2055
- End
- Attribute VB_Name = "frm4_3_4"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdCompute_Click()
- Dim p As Single, r As Single, c As Single, n As Single
- 'Find the future value of a bank deposit
- Call InputData(p, r, c, n)
- Call DisplayBalance(p, r, c, n)
- End Sub
- Private Sub DisplayBalance(p As Single, r As Single, c As Single, n As Single)
- Dim balance As Single
- 'Display the balance in the picture box
- picBalance.Cls
- balance = FV(p, r, c, n)
- picBalance.Print FormatCurrency(balance)
- End Sub
- Private Function FV(p As Single, r As Single, c As Single, n As Single) As Single
- Dim i As Single, m As Single
- 'Find the future value of a bank savings account
- 'p principal, the amount deposited
- 'r annual rate of interest
- 'c number of times interest is compounded per year
- 'n number of years
- 'i interest rate per period
- 'm total number of times interest is compounded
- i = r / c
- m = c * n
- FV = p * ((1 + i) ^ m)
- End Function
- Private Sub InputData(p As Single, r As Single, c As Single, n As Single)
- 'Get the four values from the text boxes
- p = Val(txtAmount.Text)
- r = Val(txtRate.Text)
- c = Val(txtNumComp.Text)
- n = Val(txtNumYrs.Text)
- End Sub
-